//
//  MaiXingTuViewController.m
//  SmartWatch
//
//  Created by zwj on 2022/11/25.
//

#import "MaiXingTuViewController.h"
#import "HealthIndexViewController.h"
#import "SubmitLoadingView.h"
@interface MaiXingTuViewController ()

@end

@implementation MaiXingTuViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.isHideNavigationBar = YES;
}

- (void)initSubviews {
    [super initSubviews];
    
    UIImageView *backImage = [[UIImageView alloc]initWithImage:UIImageMake(@"monitor_maixing_back")];
    backImage.frame = CGRectMake(0, 0, kScreenWidth, 320);
    [self.view addSubview:backImage];
    
    MyLinearLayout *root = [MyLinearLayout linearLayoutWithOrientation:MyOrientation_Vert];
    root.myTop = 26 + NavigationContentTop;
    root.myHorzMargin = 15;
    root.myHeight = kAutoHeight;
    root.gravity = MyGravity_Horz_Center;
    [self.view addSubview:root];
    
    UIImageView *xinImage = [[UIImageView alloc]initWithImage:UIImageMake(@"monitor_xin")];
    xinImage.mySize = CGSizeMake( 66, 57);
    [root addSubview:xinImage];
    
    UIImageView *wenziImage = [[UIImageView alloc]initWithImage:UIImageMake(@"monitor_wenzi")];
    wenziImage.myTop = 16;
    wenziImage.mySize = CGSizeMake( 226 , 27);
    [root addSubview:wenziImage];
    
    UILabel *content = [UILabel createLabelText:@"您的即时脉形图" font:UIFontBoldMake(20) textColor:HexColor(@"#3F2023")];
    content.mySize = kAutoSize;
    [root addSubview:content];
    
    UIImageView *xindiantuImage = [[UIImageView alloc]initWithImage:UIImageMake(@"monitor_xindiantu")];
    xindiantuImage.myTop = 110;
    xindiantuImage.mySize = CGSizeMake( kScreenWidth - 20 , 190);
    [root addSubview:xindiantuImage];
    
    UIImageView *gifImage = [[UIImageView alloc]initWithImage:[UIImage qmui_animatedImageNamed:@"xindiantu.gif"]];
    gifImage.frame = CGRectMake(0, 0, kScreenWidth - 20 , 190);
    [xindiantuImage addSubview:gifImage];
    
    
    UIButton *stopBtn = [UIButton createButtonText:@"停止检测" font:UIFontMake(15) textColor:HexColor(@"#BABABA")];
    stopBtn.myHorzMargin = 0;
    stopBtn.myHeight = 46;
    stopBtn.myTop = 90;
    ViewCorner(stopBtn, 23);
    ViewBorder(stopBtn, 1, HexColor(@"#ECECEC"));
    [stopBtn addTarget:self action:@selector(stopBtnClick) forControlEvents:UIControlEventTouchUpInside];
    [root addSubview:stopBtn];
    
    
    
}

- (void)stopBtnClick {
    
    SubmitLoadingView *resultView = [[SubmitLoadingView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth - 120, 245)];
    resultView.text = @"正在向健康大数据系统提交用户样本数据，请勿关闭";
    WeakSelf
    [resultView setLoadComplateBlock:^{
        [weakSelf.zh_popupController dismiss];
        HealthIndexViewController *vc = HealthIndexViewController.new;
        [weakSelf showViewController:vc sender:weakSelf];
    }];
    self.zh_popupController = [zhPopupController new];
    self.zh_popupController.layoutType = zhPopupLayoutTypeCenter;
    self.zh_popupController.allowPan = NO;
    self.zh_popupController.maskAlpha = 0.7;
    self.zh_popupController.dismissOnMaskTouched = NO;
    [self.zh_popupController presentContentView:resultView];
}

@end
